package com.seu.me.netty.cases.httpfile;

import com.seu.me.utils.HttpCallerUtils;

import java.io.File;
import java.io.FileOutputStream;
import java.util.HashMap;
import java.util.Map;

/**
 * @author liangfeihu
 * @since 2017/12/27 10:46.
 */
public class Test {

    public static void main(String[] args) throws Exception {
        Map<String, String> params = new HashMap<String, String>();
        byte[] ret = HttpCallerUtils.getStream("http://localhost:8765/sources/linux.txt", params);

        //byte[] ret = HttpProxy.get("http://localhost:8765/images/006.jpg");
        //写出文件
        String writePath = System.getProperty("user.dir") + File.separatorChar + "receives" + File.separatorChar + "mylinux2.txt";
        FileOutputStream fos = new FileOutputStream(writePath);
        fos.write(ret);
        fos.close();
    }

}
